import { createRouter, createWebHistory } from 'vue-router'
import Home from '../views/home.vue'

const routes = [
  {
    path: '/',
    name: 'home',
    component: Home
  },
  {
    path: '/write',
    name: 'write',
    component: () => import('../views/write.vue')
  },
  {
    path: '/blogs/:id',
    name: 'blogs',
    props: true,
    component: () => import('../views/blog.vue')
  },
  {
    path: '/groups/:groupId',
    name: 'groups',
    props: true,
    component: Home
  },
  {
    path: '/crud',
    name: 'crud',
    component: () => import('../views/write.vue'),
    children: [
      {
        path: ':moduleId',
        name: 'crud-list',
        props: true,
        component: () => import('../views/write.vue')
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(),
  // base: '/blog/',
  routes
})

// console.log('创建路由——————', router)
export default router
